﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!--DXMETADATA start type="MetaCharset" --><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"><!--DXMETADATA end-->
    <meta http-equiv="X-UA-Compatible" value="IE=9" />

    <!--DXMETADATA start type="Literal" condition="helpversion:value=3" value="<meta name=""Microsoft.Help.SelfBranded"" content=""true"" />" --><!--DXMETADATA end-->
    <!--DXMETADATA start type="ItemTitle" format="<title>%%ProjectTitle%% - %%ItemTitle%%</title>" --><title>SpreadJS Documentation - Create Custom Culture</title><!--DXMETADATA end-->
    <!--DXMETADATA start type="ItemTitle" format="<meta name=""Title"" content=""%%ProjectTitle%% - %%ItemTitleNoQuotes%%""/>" --><meta name="Title" content="SpreadJS Documentation - Create Custom Culture"/><!--DXMETADATA end-->
    
    <!--DXMETADATA start type="PackageLink" packagename="jquery" filetype="script" firstlinkattributes="id=""mshs_support_script"""--><script src="template/packages/jquery/script/default/jquery-1.11.3.min.js" type="text/javascript" id="mshs_support_script"></script><!--DXMETADATA end-->
    <!--DXMETADATA start type="PackageLink" packagename="jquery-ui" filetype="script"--><script src="template/packages/jquery-ui/script/default/jquery-ui-1.11.4.min.js" type="text/javascript"></script><!--DXMETADATA end-->
    <!--DXMETADATA start type="PackageLink" packagename="jquery-ui" filetype="css"--><link rel="stylesheet" type="text/css" href="template/packages/jquery-ui/css/default/jquery-ui-1.11.4.css"></link><!--DXMETADATA end-->
    <!--DXMETADATA start type="TemplateSettingsJson" format="<script type=""text/javascript"">var Innovasys=(Innovasys||{});$.extend(true,Innovasys,{settings:{isHideBodyDuringLoadDisabled:true,dynamictoc:{isEnabled:true},inthistopic:{isSupported:true},dynamicstyles:{isDynamicWordWrapEnabled:true}}},{settings:%%TemplateSettingsJson%%});</script>" --><script type="text/javascript">var Innovasys=(Innovasys||{});$.extend(true,Innovasys,{settings:{isHideBodyDuringLoadDisabled:true,dynamictoc:{isEnabled:true},inthistopic:{isSupported:true},dynamicstyles:{isDynamicWordWrapEnabled:true}}},{settings:{"dynamictoc":{"initialNodeId":"n299","initialNodeContainer":"c0","isResizable":true},"inthistopic":{"isEnabled":true},"currentLocale":"-","isFrameless":true,"navigationKind":"inpage","versions":{"locale":{"currentId":"-"}}}});</script><!--DXMETADATA end-->
    <!--DXMETADATA start type="PackageLink" packagename="light" filetype="css"--><link rel="stylesheet" type="text/css" href="template/packages/light/css/dynamic-toc.css"></link><!--DXMETADATA end-->
    <!--DXMETADATA start type="Synopsis" StripHtmlTags="True" MaxLength="250" format="<meta name=""Description"" content=""%%Synopsis%%"" />"--><meta name="Description" content="You can modify the culture string and create a custom culture using the CultureInfo class." /><!--DXMETADATA end-->
    
    <!--DXMETADATA start type="PackageLink" packagename="plugins-topics" filetype="css"--><link rel="stylesheet" type="text/css" href="template/packages/plugins-topics/css/default/jquery-plugins.css"></link><!--DXMETADATA end-->
    <!--DXMETADATA start type="PackageLink" packagename="core-topics" filetype="css" firstlinkattributes=" data-mshv2-stylesheet=""/template/packages/core-topics/topics.mshv2.css"" data-mshv1-stylesheet=""/template/packages/core-topics/topics.mshv1.css"" data-responsive-mobile=""template/packages/core-topics/topics.mobile.css"" data-responsive-tablet=""template/packages/core-topics/topics.tablet.css"""--><link rel="stylesheet" type="text/css" href="template/packages/core-topics/css/topics.css"  data-mshv2-stylesheet="/template/packages/core-topics/topics.mshv2.css" data-mshv1-stylesheet="/template/packages/core-topics/topics.mshv1.css" data-responsive-mobile="template/packages/core-topics/topics.mobile.css" data-responsive-tablet="template/packages/core-topics/topics.tablet.css"></link><!--DXMETADATA end-->
    <!--DXMETADATA start type="PackageLink" packagename="plugins-topics" filetype="script"--><script src="template/packages/plugins-topics/script/default/jquery-plugins.min.js" type="text/javascript"></script><!--DXMETADATA end-->
    <!--DXMETADATA start type="PackageLink" packagename="core-topics" filetype="script"--><script src="template/packages/core-topics/script/topics.min.js" type="text/javascript"></script><!--DXMETADATA end-->
    
    <!--DXMETADATA start type="TopicId" format="<meta name=""Microsoft.Help.Id"" content=""%%TopicId%%""/>" --><meta name="Microsoft.Help.Id" content="12044ac0-a1cb-4d7d-b0d0-d69c69463e3f"/><!--DXMETADATA end-->
    <!--DXMETADATA start type="TocParentId" format="<meta name=""Microsoft.Help.TocParent"" content=""%%TocParentId%%""/>" --><meta name="Microsoft.Help.TocParent" content="da8d5ee2-66da-499e-ac0f-b91757afe8e7"/><!--DXMETADATA end-->
    <!--DXMETADATA start type="TocOrdinal" format="<meta name=""Microsoft.Help.TocOrder"" content=""%%TocOrdinal%%""/>" --><meta name="Microsoft.Help.TocOrder" content="3"/><!--DXMETADATA end-->
    <meta name="Microsoft.Help.F1" content=""/>
    <meta name="Microsoft.Help.ContentType" content="Concepts" />
    <!--DXMETADATA start type="MshvKeywords" condition="helpversion:value=3" --><!--DXMETADATA end-->
    <!--DXMETADATA start type="MshvMetaTags" condition="helpversion:value=3" --><!--DXMETADATA end-->
    <!--DXMETADATA start type="Help3CatalogLocale" condition="helpversion:value=3" format="<meta name=""Microsoft.Help.Locale"" content=""%%Help3CatalogLocale%%"" />"--><!--DXMETADATA end-->
    <!--DXMETADATA start type="Help3CatalogLocale" condition="helpversion:value=3" format="<meta name=""Microsoft.Help.TopicLocale"" content=""%%Help3CatalogLocale%%"" />"--><!--DXMETADATA end-->
    <!--DXMETADATA start type="Stylesheets" --><link rel="stylesheet" type="text/css" href="stylesheets/hs-simpletab.css"></link><!--DXMETADATA end-->
    <!--DXMETADATA start type="StylePropertyValues" format="<style>%%StylePropertyValues%%</style>" --><style>.i-is-new .i-page-title-text::after, ul#i-dt-root li.i-is-new>a::after { content: "New" }
</style><!--DXMETADATA end-->
    <!--DXMETADATA start type="Scripts" --><!--DXMETADATA end-->
    <!--DXMETADATA start type="DesignTime"--><!--DXMETADATA end-->
    <!--DXMETADATA start type="Scrap" condition="communityenabled" name="_COMMUNITY_PROPERTIES" --><!--DXMETADATA end -->
    <!--DXMETADATA start type="CustomHeadContent" --><link rel="stylesheet" type="text/css" href="template/packages/core-web/css/SP.css">
<script type="text/javascript">
var currentHeader = function() {
    return "spjs";
}
</script>
<script src="template/packages/core-web/script/topNavigation.js"></script>
<script async="" src="https://www.googletagmanager.com/gtm.js?id=GTM-WT462SJ"></script>
<script>
        (function (w, d, s, l, i) {
            w[l] = w[l] || [];
            w[l].push({
                'gtm.start': new Date().getTime()
                , event: 'gtm.js'
            });
            var f = d.getElementsByTagName(s)[0]
                , j = d.createElement(s)
                , dl = l != 'dataLayer' ? '&l=' + l : '';
            j.async = true;
            j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
            f.parentNode.insertBefore(j, f);
        })(window, document, 'script', 'dataLayer', 'GTM-WT462SJ');
    </script>
<!--DXMETADATA end-->
</head>

<body>
    <div id="i-before-header-content" class="i-before-header-content">
        
    </div>

    <div id="i-header-container">
        <div id="i-header-content" class="i-header-content i-content-width-container">
            <!--DXMETADATA start type="LogoImage" --><!--DXMETADATA end-->
            <div class="i-project-title"><!--DXMETADATA start type="ProjectTitle" -->SpreadJS Documentation<!--DXMETADATA end--></div>
            <div class="i-search-container">
                <!--DXMETADATA start type="outputfileextension" format="<form action=""websearch%%outputfileextension%%"">" --><form action="websearch.html"><!--DXMETADATA end-->
                <input id="i-search" name="query"/>
                <input type="submit" id="i-search-button" value=""/>
                <!--DXMETADATA start type="Literal" value="</form>" --></form><!--DXMETADATA end-->
            </div>
            <!--DXMETADATA start type="outputfileextension" format="<a id=""i-index-button"" href=""webindex%%outputfileextension%%""></a>" --><a id="i-index-button" href="webindex.html"></a><!--DXMETADATA end-->
        </div>
    </div>
    
    <div class="i-content-width-container"><div class="i-busy-overlay"></div></div>

    <div id="i-breadcrumbs-outer-container" class="i-content-width-container"><!--DXMETADATA start type="Breadcrumbs" scrap="_BREADCRUMBS" --><div class="i-breadcrumbs-container">
<a href="overview.html">SpreadJS Documentation</a>
 / <a href="devguide.html">Developer's Guide</a>
 / <a href="features.html">Features</a>
 / <a href="managedata.html">Manage Data</a>
 / Create Custom Culture</div><!--DXMETADATA end --></div>

    

    <div id="i-actions-outer-container" class="i-content-width-container">
        <div id="i-actions-container">
            <div id="i-actions-content" class="i-fixed-to-top">
                <!-- Spacing --> <span class="i-toggle-all-sections i-function-link">
                <label class="i-collapse-all"><!--DXMETADATA start type="Phrase" name="COLLAPSE_ALL" -->Collapse All<!--DXMETADATA end--></label>
                <label class="i-expand-all" style="display: none;"><!--DXMETADATA start type="Phrase" name="EXPAND_ALL" -->Expand All<!--DXMETADATA end--></label>
            </span><!--DXMETADATA start type="Literal" condition="communityenabled" value="%%scrap:name=_COMMUNITY_DROPDOWN%%" --><!--DXMETADATA end -->
                <div class="i-in-this-topic-container">
                    <span class="i-action-group-heading"><!--DXMETADATA start type="Phrase" Name="IN_THIS_TOPIC" -->In This Topic<!--DXMETADATA end--></span>
                </div>
            </div>
        </div>
    </div>

    <div id="i-toc-outer-container" class="i-content-width-container">
        <div id="i-toc-container">
            <div id="i-toc-content" class="i-fixed-to-top">
                <div class="i-toc-content-scroll-container">
                    <div id="i-dynamic-toc-container"><ul id="i-dt-root"></ul></div>
                </div>
            </div>
        </div>
    </div>

    <div id="i-body-content-container" class="i-content-width-container">
        <div id="i-body-content" class="i-body-content">
            <div class="i-page-title"><div class="i-page-title-text"><!--DXMETADATA start type="ItemTitle" -->Create Custom Culture<!--DXMETADATA end--></div></div>
            <div class="i-in-this-topic-container">
                <span class="i-action-group-heading"><!--DXMETADATA start type="Phrase" Name="IN_THIS_TOPIC" -->In This Topic<!--DXMETADATA end--></span>
            </div>
            <!--DXMETADATA start type="TopicSection" name="BodyText"--><p>You can modify the culture string and create a custom culture using the&nbsp;<strong>CultureInfo</strong> class.</p>

<p>The following table lists the class variables, default values, and basic descriptions.</p>

<table>
    <tbody>
        <tr>
            <td><strong>Variable Name</strong></td>

            <td><strong>Default Value</strong></td>

            <td><strong>Description</strong></td>
        </tr>

        <tr>
            <td>currencySymbol</td>

            <td>"\u00A4"</td>

            <td>Dollar is "$"</td>
        </tr>

        <tr>
            <td>numberDecimalSeparator</td>

            <td>"."</td>

            <td>Decimal point</td>
        </tr>

        <tr>
            <td>numberGroupSeparator</td>

            <td>","</td>

            <td>Thousand separator</td>
        </tr>

        <tr>
            <td>arrayGroupSeparator</td>

            <td>";"</td>

            <td>Separator for array constant in formula</td>
        </tr>

        <tr>
            <td>listSeparator</td>

            <td>","</td>

            <td>Separator for function arguments in formula</td>
        </tr>

        <tr>
            <td>aMDesignator</td>

            <td>"AM"</td>

            <td>&nbsp;</td>
        </tr>

        <tr>
            <td>pMDesignator</td>

            <td>"PM"</td>

            <td>&nbsp;</td>
        </tr>

        <tr>
            <td>abbreviatedMonthNames</td>

            <td>["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""]</td>

            <td>Formatter is "MMM"</td>
        </tr>

        <tr>
            <td>abbreviatedDayNames</td>

            <td>["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]</td>

            <td>Formatter is "ddd"</td>
        </tr>

        <tr>
            <td>abbreviatedMonthGenitiveNames</td>

            <td>["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""]</td>

            <td>Formatter is "MMM"</td>
        </tr>

        <tr>
            <td>dayNames</td>

            <td>["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]</td>

            <td>Formatter is "dddd"</td>
        </tr>

        <tr>
            <td>fullDateTimePattern</td>

            <td>"dddd, dd MMMM yyyy HH:mm:ss"</td>

            <td>Standard date formatter "F"</td>
        </tr>

        <tr>
            <td>longDatePattern</td>

            <td>"dddd, dd MMMM yyyy"</td>

            <td>Standard date formatter "D"</td>
        </tr>

        <tr>
            <td>longTimePattern</td>

            <td>"HH:mm:ss"</td>

            <td>Standard date formatter "T" and "U"</td>
        </tr>

        <tr>
            <td>monthDayPattern</td>

            <td>"MMMM dd"</td>

            <td>Standard date formatter "M" and "m"</td>
        </tr>

        <tr>
            <td>monthNames</td>

            <td>["January", "February", "March", "April", "May", "June", "July",<br />
            "August", "September", "October", "November", "December", ""]</td>

            <td>Formatter is "M" or "MM"</td>
        </tr>

        <tr>
            <td>monthGenitiveNames</td>

            <td>["January", "February", "March", "April", "May", "June", "July",<br />
            "August", "September", "October", "November", "December", ""]</td>

            <td>Formatter is "MMMM"</td>
        </tr>

        <tr>
            <td>rFC1123Pattern</td>

            <td>"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'"</td>

            <td>Standard date formatter "R" and "r"</td>
        </tr>

        <tr>
            <td>shortDatePattern</td>

            <td>"MM/dd/yyyy"</td>

            <td>Standard date formatter "d"</td>
        </tr>

        <tr>
            <td>shortTimePattern</td>

            <td>"HH:mm"</td>

            <td>Standard date formatter "t"</td>
        </tr>

        <tr>
            <td>sortableDateTimePattern</td>

            <td>"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss"</td>

            <td>Standard date formatter "s"</td>
        </tr>

        <tr>
            <td>universalSortableDateTimePattern</td>

            <td>"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'"</td>

            <td>Standard date formatter "u"</td>
        </tr>

        <tr>
            <td>yearMonthPattern</td>

            <td>"yyyy MMMM"</td>

            <td>Standard date formatter "y" and "Y"</td>
        </tr>
    </tbody>
</table>

<p>You can display the custom culture by setting the cell format using the&nbsp;<a href="SpreadJS~GC.Spread.Formatter.GeneralFormatter.html">GeneralFormatter</a> class.</p>

<h4>Using Code</h4>

<p>The following code creates a custom culture and sets a date time formatter for&nbsp;cell (1,0) and (3,0) and a number formatter for cell (0,0).</p>

<div class="i-filtered-content-JavaScript" data-title="JavaScript" data-itemid="JavaScript">
    <table class="i-syntax-table">
        <tbody>
            <tr>
                <th>JavaScript</th>

                <th>
                    <div class="i-copy-code-wrapper">
                        <span class="i-copy-code">Copy Code</span>
                    </div>
                </th>
            </tr>

            <tr>
                <td class="i-code" colspan="2">
                    <p>var myCulture = new GC.Spread.Common.CultureInfo();<br />
                    myCulture.NumberFormat.currencySymbol = "€"<br />
                    myCulture.NumberFormat.numberDecimalSeparator = ",";<br />
                    myCulture.NumberFormat.numberGroupSeparator = ".";<br />
                    myCulture.NumberFormat.arrayGroupSeparator = ";";<br />
                    myCulture.NumberFormat.arrayListSeparator = "\\";<br />
                    myCulture.NumberFormat.listSeparator = ";";</p>

                    <p>myCulture.DateTimeFormat.amDesignator = "";<br />
                    myCulture.DateTimeFormat.pmDesignator = "";<br />
                    myCulture.DateTimeFormat.abbreviatedMonthNames = ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez", ""];<br />
                    myCulture.DateTimeFormat.abbreviatedDayNames = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];<br />
                    myCulture.DateTimeFormat.abbreviatedMonthGenitiveNames = ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez", ""];<br />
                    myCulture.DateTimeFormat.dayNames = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"];<br />
                    myCulture.DateTimeFormat.fullDateTimePattern = "dddd, d. MMMM yyyy HH:mm:ss";<br />
                    myCulture.DateTimeFormat.longDatePattern = "dddd, d. MMMM yyyy";<br />
                    myCulture.DateTimeFormat.longTimePattern = "HH:mm:ss";<br />
                    myCulture.DateTimeFormat.monthDayPattern = "dd MMMM";<br />
                    myCulture.DateTimeFormat.monthNames = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""];<br />
                    myCulture.DateTimeFormat.monthGenitiveNames = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""];<br />
                    myCulture.DateTimeFormat.shortDatePattern = "dd.MM.yyyy";<br />
                    myCulture.DateTimeFormat.shortTimePattern = "HH:mm";<br />
                    myCulture.DateTimeFormat.yearMonthPattern = "MMMM yyyy";</p>

                    <p>//add one culture<br />
                    GC.Spread.Common.CultureManager.addCultureInfo("de-DE", myCulture);<br />
                    //switch to "de-DE" culture<br />
                    GC.Spread.Common.CultureManager.culture("de-DE");<br />
                    var d = new Date();<br />
                    //With culture<br />
                    activeSheet.setValue(1, 0, new Date(d.setDate(d.getDate() + 1)));<br />
                    activeSheet.getCell(1, 0).formatter("mmm");<br />
                    var dvalue = 12345.6789;<br />
                    activeSheet.setColumnWidth(0, 200);<br />
                    activeSheet.setColumnWidth(1, 200);<br />
                    activeSheet.setColumnWidth(2, 200);<br />
                    activeSheet.setValue(0, 0, dvalue);<br />
                    activeSheet.getCell(0, 0).formatter("###,###.00");</p>

                    <p>activeSheet.setValue(2, 0, new Date(d.setDate(d.getDate() + 1)));<br />
                    //With culture<br />
                    activeSheet.getCell(3, 0).formatter("yyyy/mmm/dddd");<br />
                    activeSheet.setValue(3, 0, new Date());</p>
                </td>
            </tr>
        </tbody>
    </table>
</div><!--DXMETADATA end-->
            <a name="seealsobookmark"></a>
            <!--DXMETADATA start type="FilteredItemList" scrap="CATEGORISED_LINKS" namespace="linkcategory" source="Item" filter="" NoHeader="True" NoFooter="True" format="%%replaceinquotes:value=false%%%%scrap:name=_COLLAPSIBLE_HEADER,idprefix=seealso,caption=""%%phrase:name=SeeAlso%%%%designlist:tagidentifier=seealso,itemtype=See Also%%""%%%%filtereditemlist%%</div>"--><div class="i-section-heading" id="i-seealso-section-heading"><span class="i-section-heading-icon"><!-- --></span><span class="i-section-heading-text">See Also</span></div><div id="i-seealso-section-content" class="i-section-content"><div class="i-see-also-link">
<a href="cultureoption.html">Set Culture</a></div>
<div class="i-see-also-link">
<a href="eraformat.html">Set Era Format</a></div>
<div class="i-see-also-link">
<a href="cellformat.html">Cell Format</a></div>

</div><!--DXMETADATA end-->
            
            <div id="i-footer-content" class="i-footer-content">
                <!--DXMETADATA start type="Scrap" condition="communityenabled" name="_COMMUNITY_FOOTER" --><!--DXMETADATA end -->
<!--DXMETADATA start type="Variable" name="CopyrightNotice" format="<p>&nbsp;</p><p>&nbsp;</p><hr style=""height: 1px"" /><p>%%variable%%</p>" --><p>&nbsp;</p><p>&nbsp;</p><hr style="height: 1px" /><p><p>Copyright © 2019 GrapeCity, Inc. All rights reserved.</p>
<p><a href="https://www.grapecity.com/en/forums/winforms-edition" target="_blank">Product Support Forum</a> | <a href="javascript:window.print()">Print this page</a></p>
<ul class="social">
<li><a href="https://www.facebook.com/GrapeCityUS/" target="_blank" class="facebook">&nbsp;</a></li>
<li><a href="https://twitter.com/GrapeCityUS" target="_blank" class="twitter">&nbsp;</a></li>
<li><a href="https://www.linkedin.com/company/grapecity" target="_blank" class="linkedin">&nbsp;</a></li>
</ul>
</p><!--DXMETADATA end -->
<!--DXMETADATA start type="Variable" name="FeedbackLink" format="" --><!--DXMETADATA end-->
            </div>
        </div>
    </div>
        
    <script type="text/javascript">
        $(function () {
            var documentInstance = new Innovasys.Content.Document(document.body);
            documentInstance.load();
        });
    </script>
</body>
</html>
